home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / share / laptop-mode-tools / modules / bluetooth < prev    next >
Encoding:
Text File  |  2008-10-24  |  921 b   |  31 lines

  1. #! /bin/sh
  2. #
  3. # Laptop mode tools module: bluetooth
  4. #
  5.  
  6.  
  7. if [ x$CONTROL_BLUETOOTH = x1 ] ; then
  8.     ENABLE_BLUETOOTH=$BATT_ENABLE_BLUETOOTH
  9.     if [ $ON_AC -eq 1 ] ; then
  10.         ENABLE_BLUETOOTH=$AC_ENABLE_BLUETOOTH
  11.     fi
  12.     if [ x$ENABLE_BLUETOOTH = x1 ] ; then
  13.         $LM_VERBOSE && echo "Enabling bluetooth." >> $OUTPUT
  14.         modprobe -q hci_usb
  15.         for INTF in $BLUETOOTH_INTERFACES ; do
  16.             [ -d /sys/class/bluetooth/$INTF ] || continue
  17.             hciconfig $INTF up 2>&1 >> $OUTPUT
  18.         done
  19.     else
  20.         $LM_VERBOSE && echo "Disabling bluetooth." >> $OUTPUT
  21.         for INTF in $BLUETOOTH_INTERFACES ; do
  22.             [ -d /sys/class/bluetooth/$INTF ] || continue
  23.             hciconfig $INTF down 2>&1 >> $OUTPUT
  24.         done
  25.         # This may take a while to work because the module may be
  26.         # temporarily in use; we try three times. We don't use rmmod
  27.         # --wait, because that might hang!
  28.         modprobe -rq hci_usb || (sleep 1 ; modprobe -rq hci_usb) || (sleep 1 ; modprobe -rq hci_usb)        
  29.     fi
  30. fi
  31.